import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, OneToMany } from 'typeorm';
import { PageView } from './page-view.entity';

@Entity('websites')
export class Website {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ length: 100, unique: true })
  domain: string;

  @Column({ length: 255 })
  name: string;

  @Column({ nullable: true })
  description: string;

  @Column({ default: true })
  isActive: boolean;

  @Column({ nullable: true, length: 64 })
  trackingId: string;

  @Column({ default: false })
  ignoreLocalhost: boolean;

  @Column({ default: true })
  collectIp: boolean;

  @Column({ default: true })
  collectUserAgent: boolean;

  @Column({ default: true })
  collectReferrer: boolean;

  @OneToMany(() => PageView, pageView => pageView.website)
  pageViews: PageView[];

  @CreateDateColumn()
  createdAt: Date;

  @UpdateDateColumn()
  updatedAt: Date;
} 